﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Pages_QueryList : DatabasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            lblMessage.Text = String.Empty;

            if (!IsPostBack)
            {
                SetContentHeader();
                gvQueryList.DataSource = DBData.Queries(ConnectionId);
                gvQueryList.DataBind();
            }
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.Message;
        }
    }
    protected void gvQueryList_SelectedIndexChanged(object sender, EventArgs e)
    {
        Response.Redirect(string.Format("Query.aspx?QueryId={0}", gvQueryList.SelectedValue));
    }

    private void SetContentHeader()
    {
        OutlookMaster om = (OutlookMaster)Master;
        om.ContentHeader.Text = "Query list";
    }
}